package com.star.jersey.mybatisplus.base.core.contract.enums;

public enum ResultCode implements IEnum<Integer> {
    OK(200, "请求/操作成功"),
    FAIL(500, "请求成功但是服务异常"),
    UNAUTHORIZED(401, "未登录或token已经失效"),
    FORBIDDEN(403, "没有权限"),
    SERVER_ERROR(500, "服务器异常"),
    REQUEST_ERROR(400, "请求异常");

    private Integer code;
    private String desc;

    private ResultCode(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static String getDescByCode(Integer code) {
        String desc = "";
        ResultCode[] var2 = values();
        int var3 = var2.length;

        for (int var4 = 0; var4 < var3; ++var4) {
            ResultCode codeEnum = var2[var4];
            if (codeEnum.getCode().equals(code)) {
                desc = codeEnum.getDesc();
                break;
            }
        }

        return desc;
    }

    public static ResultCode getByCode(Integer code) {
        ResultCode resultCode = null;
        ResultCode[] var2 = values();
        int var3 = var2.length;

        for (int var4 = 0; var4 < var3; ++var4) {
            ResultCode codeEnum = var2[var4];
            if (codeEnum.getCode().equals(code)) {
                resultCode = codeEnum;
                break;
            }
        }

        return resultCode;
    }

    public Integer getCode() {
        return this.code;
    }

    public String getDesc() {
        return this.desc;
    }
}